package com.mypackage.diary.model;

// Generated Nov 7, 2014 12:02:55 AM by Hibernate Tools 3.4.0.CR1

import java.util.Date;
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * Friendrequest generated by hbm2java
 */
@Entity
@Table(name = "friendrequest", catalog = "diary")
public class Friendrequest implements java.io.Serializable {

	private FriendrequestId id;
	private Userprofile userprofileByReceiverId;
	private Userprofile userprofileBySenderId;
	private Date created;

	public Friendrequest() {
	}

	public Friendrequest(FriendrequestId id,
			Userprofile userprofileByReceiverId,
			Userprofile userprofileBySenderId) {
		this.id = id;
		this.userprofileByReceiverId = userprofileByReceiverId;
		this.userprofileBySenderId = userprofileBySenderId;
	}

	public Friendrequest(FriendrequestId id,
			Userprofile userprofileByReceiverId,
			Userprofile userprofileBySenderId, Date created) {
		this.id = id;
		this.userprofileByReceiverId = userprofileByReceiverId;
		this.userprofileBySenderId = userprofileBySenderId;
		this.created = created;
	}

	@EmbeddedId
	@AttributeOverrides({
			@AttributeOverride(name = "senderId", column = @Column(name = "SenderId", nullable = false)),
			@AttributeOverride(name = "receiverId", column = @Column(name = "ReceiverId", nullable = false)) })
	public FriendrequestId getId() {
		return this.id;
	}

	public void setId(FriendrequestId id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ReceiverId", nullable = false, insertable = false, updatable = false)
	public Userprofile getUserprofileByReceiverId() {
		return this.userprofileByReceiverId;
	}

	public void setUserprofileByReceiverId(Userprofile userprofileByReceiverId) {
		this.userprofileByReceiverId = userprofileByReceiverId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "SenderId", nullable = false, insertable = false, updatable = false)
	public Userprofile getUserprofileBySenderId() {
		return this.userprofileBySenderId;
	}

	public void setUserprofileBySenderId(Userprofile userprofileBySenderId) {
		this.userprofileBySenderId = userprofileBySenderId;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "Created", length = 19)
	public Date getCreated() {
		return this.created;
	}

	public void setCreated(Date created) {
		this.created = created;
	}

}
